import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
   @WebServlet("/demo1")
   public class Demo1  extends HttpServlet {
   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    req.setCharacterEncoding("UTF-8");
    System.out.println("看看doget方法执行了吗");
    String name = req.getParameter("username");
    String password = req.getParameter("password");
   //System.out.println("前端用户传过来的密码:"+password);
   // System.out.println("前端用户传过来的值:"+name);
    String[] hobby=req.getParameterValues("hobby");
    for (String h:hobby)
   System.out.println(h+" ");resp.setHeader("content-type", "text/html;charset=UTF-8");
   resp.getWriter().write("<h1>欢迎"+name+"登录</h1>");
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    this.doGet(req, resp);

 }
}
